using System.Collections;
using System.Collections.Generic;
using System.Collections.Specialized;
using System.IO;
using NetWorkMsg;
using NetMsg.Equip;

// 喂养
namespace NetMsg.Dragon
{
    public enum DragonAttribute
    {
        Ice,
        Fire,
        Storm,
        Poison,
    }
    
    public class DragonInfo : IUnPackable
    {
        //龙的名称,为空则取配置
        public string Name;
        // 是否突破了
        public bool IsBreaked;
        public int DragonId;
        public int CfgId;
        public int CharacterId;
        public int Level;
        public int Exp;
        public int Hp;
        public int HpMax;
        public int HpBase;
        public int Sp;
        public int SpMax;
        public int Attack;
        public int AttackBase;
        public int FireDef;
        public int IceDef;
        public int StormDef;
        public int PoisonDef;
        public int HappyExp;
        public int GrowthExp;
        public int FriendExp;
        public EquipInfo Equip;
        
        public void UnPack(MemoryStream stream)
        {
            UnPackAuxiliary.Read(stream, out Name);
            UnPackAuxiliary.Read(stream, out IsBreaked);
            UnPackAuxiliary.Read(stream, out uint var0);
            DragonId = (int)var0;
            UnPackAuxiliary.Read(stream, out uint var1);
            CfgId = (int)var1;
            UnPackAuxiliary.Read(stream, out uint var2);
            CharacterId = (int)var2;
            UnPackAuxiliary.Read(stream, out uint var3);
            Level = (int)var3;
            UnPackAuxiliary.Read(stream, out uint var4);
            Exp = (int)var4;
            UnPackAuxiliary.Read(stream, out uint var5);
            Hp = (int)var5;
            UnPackAuxiliary.Read(stream, out uint var6);
            HpMax = (int)var6;
            UnPackAuxiliary.Read(stream, out uint var7);
            HpBase = (int)var7;
            UnPackAuxiliary.Read(stream, out uint var8);
            Sp = (int)var8;
            UnPackAuxiliary.Read(stream, out uint var9);
            SpMax = (int)var9;
            UnPackAuxiliary.Read(stream, out uint var10);
            Attack = (int)var10;
            UnPackAuxiliary.Read(stream, out uint var11);
            AttackBase = (int)var11;
            UnPackAuxiliary.Read(stream, out FireDef);
            UnPackAuxiliary.Read(stream, out IceDef);
            UnPackAuxiliary.Read(stream, out StormDef);
            UnPackAuxiliary.Read(stream, out PoisonDef);
            UnPackAuxiliary.Read(stream, out uint var12);
            HappyExp = (int)var12;
            UnPackAuxiliary.Read(stream, out uint var13);
            GrowthExp = (int)var13;
            UnPackAuxiliary.Read(stream, out uint var14);
            FriendExp = (int)var14;
            UnPackAuxiliary.Read(stream, out bool var15);
            if(var15)
            {
                Equip = new EquipInfo();
                Equip.UnPack(stream);
            }
        }
    }
    
    // 获得数据
    public struct GetDragonsQ : IServerCallbackable
    {
        
        public uint UnPackableId => 11;
        public uint PackableId => 24;
        
        public void Pack(MemoryStream stream)
        {
            PackAuxiliary.Write(stream, 24u);
        }
    }
    
    public class GetDragonsP : IUnPackable
    {
        public List<DragonInfo> Dragons;
        
        public const uint Sid = 11;
        
        public void UnPack(MemoryStream stream)
        {
            UnPackAuxiliary.Read(stream, out uint var0);
            Dragons = new List<DragonInfo>((int)var0);
            for(var i = 0; i < var0; ++i)
            {
                var var1 = new DragonInfo();
                var1.UnPack(stream);
                Dragons.Add(var1);
            }
        }
    }
    
    public enum UnInstallDragonResult
    {
        Success,
        // 上阵中
        IsFighter,
    }
    
    public struct UnInstallDragonQ : IServerCallbackable
    {
        public int DragonId;
        
        public uint UnPackableId => 12;
        public uint PackableId => 25;
        
        public void Pack(MemoryStream stream)
        {
            PackAuxiliary.Write(stream, 25u);
            PackAuxiliary.Write(stream, (uint)DragonId);
        }
    }
    
    public struct UnInstallDragonP : IUnPackable
    {
        public UnInstallDragonResult Result;
        // 增加的原始数据
        public int ExpInc;
        
        public const uint Sid = 12;
        
        public void UnPack(MemoryStream stream)
        {
            UnPackAuxiliary.Read(stream, out uint var0);
            Result = (UnInstallDragonResult)var0;
            UnPackAuxiliary.Read(stream, out uint var1);
            ExpInc = (int)var1;
        }
    }
    
    // 穿上装备
    public struct PutEquipOnQ : IIdPackable
    {
        public int DragonId;
        public int EquipId;
        
        public uint PackableId => 26;
        
        public void Pack(MemoryStream stream)
        {
            PackAuxiliary.Write(stream, 26u);
            PackAuxiliary.Write(stream, (uint)DragonId);
            PackAuxiliary.Write(stream, (uint)EquipId);
        }
    }
    
    // 卸下装备
    public class UnwieldEquipQ : IIdPackable
    {
        public int DragonId;
        
        public uint PackableId => 27;
        
        public void Pack(MemoryStream stream)
        {
            PackAuxiliary.Write(stream, 27u);
            PackAuxiliary.Write(stream, (uint)DragonId);
        }
    }
    
    // 升级装备
    public struct DragonEquipUpgradeQ : IIdPackable
    {
        public int DragonId;
        
        public uint PackableId => 28;
        
        public void Pack(MemoryStream stream)
        {
            PackAuxiliary.Write(stream, 28u);
            PackAuxiliary.Write(stream, (uint)DragonId);
        }
    }
    
    // 分解装备
    public struct DragonEquipResolveQ : IIdPackable
    {
        public int DragonId;
        
        public uint PackableId => 29;
        
        public void Pack(MemoryStream stream)
        {
            PackAuxiliary.Write(stream, 29u);
            PackAuxiliary.Write(stream, (uint)DragonId);
        }
    }
    
    // 龙进化
    public struct DragonEvolutionQ : IIdPackable
    {
        public int DragonId;
        public int EquipId;
        
        public uint PackableId => 30;
        
        public void Pack(MemoryStream stream)
        {
            PackAuxiliary.Write(stream, 30u);
            PackAuxiliary.Write(stream, (uint)DragonId);
            PackAuxiliary.Write(stream, (uint)EquipId);
        }
    }
    
    // 龙升级
    public struct DragonUpgradeQ : IIdPackable
    {
        public int DragonId;
        
        public uint PackableId => 31;
        
        public void Pack(MemoryStream stream)
        {
            PackAuxiliary.Write(stream, 31u);
            PackAuxiliary.Write(stream, (uint)DragonId);
        }
    }
    
    // 融合结果
    public enum DragonFuseResult
    {
        Success,
        // 龙不存在
        NotExists,
        // 上阵的龙
        InFight,
        // 装备背包满了
        EquipFull,
        // 等级不够
        NeedLevel,
    }
    
    // 融合
    public struct DragonFuseQ : IServerCallbackable
    {
        public int DragonId;
        public int SacrificeId;
        
        public uint UnPackableId => 13;
        public uint PackableId => 32;
        
        public void Pack(MemoryStream stream)
        {
            PackAuxiliary.Write(stream, 32u);
            PackAuxiliary.Write(stream, (uint)DragonId);
            PackAuxiliary.Write(stream, (uint)SacrificeId);
        }
    }
    
    public struct DragonFuseP : IUnPackable
    {
        public DragonFuseResult Result;
        
        public const uint Sid = 13;
        
        public void UnPack(MemoryStream stream)
        {
            UnPackAuxiliary.Read(stream, out uint var0);
            Result = (DragonFuseResult)var0;
        }
    }
    
    // 突破
    public struct DragonBreakQ : IIdPackable
    {
        public int DragonId;
        
        public uint PackableId => 33;
        
        public void Pack(MemoryStream stream)
        {
            PackAuxiliary.Write(stream, 33u);
            PackAuxiliary.Write(stream, (uint)DragonId);
        }
    }
    
    // 使用食物
    public struct EatFoodQ : IIdPackable
    {
        public int DragonId;
        public int FoodId;
        
        public uint PackableId => 34;
        
        public void Pack(MemoryStream stream)
        {
            PackAuxiliary.Write(stream, 34u);
            PackAuxiliary.Write(stream, (uint)DragonId);
            PackAuxiliary.Write(stream, (uint)FoodId);
        }
    }
    
    // 新龙的通知
    public class NewDragonP : IUnPackable
    {
        public DragonInfo Info;
        
        public const uint Sid = 14;
        
        public void UnPack(MemoryStream stream)
        {
            Info = new DragonInfo();
            Info.UnPack(stream);
        }
    }
    
    // 同步血量
    public struct UpdateHpQ : IIdPackable
    {
        public int DragonId;
        public int Health;
        
        public uint PackableId => 35;
        
        public void Pack(MemoryStream stream)
        {
            PackAuxiliary.Write(stream, 35u);
            PackAuxiliary.Write(stream, (uint)DragonId);
            PackAuxiliary.Write(stream, (uint)Health);
        }
    }
    
    public class ModifyNameQ : IIdPackable
    {
        public int DragonId;
        public string Name;
        
        public uint PackableId => 36;
        
        public void Pack(MemoryStream stream)
        {
            PackAuxiliary.Write(stream, 36u);
            PackAuxiliary.Write(stream, (uint)DragonId);
            PackAuxiliary.Write(stream, Name);
        }
    }
    
    public enum DragonEnum
    {
        GetDragonsP,
        UnInstallDragonP,
        DragonFuseP,
        NewDragonP,
    }
}
